package com.pz.cloud.framework.business.workflow.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.pz.cloud.framework.base.model.BaseEntity;
import com.pz.cloud.framework.util.WorkflowUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.Date;

/**
 * 用于记录流程执行的信息
 * @author mazezhan
 */
@Data
@TableName("act_process_info")
public class ProcessInfo extends BaseEntity {

    @TableId(type = IdType.ASSIGN_UUID)
    private String id; //流程实例记录主键

    private String relatedId; //关联业务记录主键
    private String relatedTable; //关联业务记录表
    /**
     * 文件标题
     */
    private String title;

    private Date endTime;//流程完成时间

    private String processBindId;//processBindId

    //流程状态 0未开启 1已提交 10流程结束 -1流程作废
    private Integer actStatus; //流程状态

    private String callback; //回调类

    /**
     * 流程是否结束
     * @return
     */
    public boolean processEnd(){
        return WorkflowUtil.isProcessEnd(id);
    }

}
